package com.ljpz.userinfo.controller;

import com.ljpz.userinfo.bean.LjpzResult;
import com.ljpz.userinfo.pojo.Userinfo;
import com.ljpz.userinfo.service.UserinfoService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Controller;
import org.springframework.stereotype.Service;
import org.springframework.web.bind.annotation.*;

/**
 * Created by liujunchen on 2017/2/9.
 */
@RequestMapping("/userinfo")
@Controller
public class UserinfoController {
    @Autowired
    private UserinfoService userinfoService ;
    @RequestMapping(value = "/create",method = RequestMethod.POST)
    @ResponseBody
    public LjpzResult createUserinfo(@RequestBody  String  json ){
        return      userinfoService.createUserinfo(json)  ;
    }
    @RequestMapping(value = "/query/{userId}")
    @ResponseBody
    public Userinfo queryUserinfo(@PathVariable("userId")Long  userId  ){
        return  userinfoService.queryByNickname(userId)  ;
    }
    @RequestMapping(value = "/update" ,method = RequestMethod.POST)
    @ResponseBody
    public  LjpzResult updateUserinfo(@RequestBody String json){
        return   userinfoService.updateUserinfo(json) ;
    }
}
